<script>
$(document).ready(function() {
    <?php
    if ($updated == 1) echo 'showNoti("Bài viết: '.$name.'", "Thêm mới bài viết thành công!", "Ok");';
    if ($failed == 1) echo 'showNoti("Bài viết: '.$name.'", "Cập nhập bài viết thất bại!", "Err");';
    if ($orderby == 'order_top') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "", "menu_top", "'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'order_bottom') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "","menu_bottom", "'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'order_footer') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "", "menu_footer", "'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'sort_order') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "", "active", "'.$orderby.'", "'.$ordermode.'");';
    if ($orderby == 'order_cat') echo 'makeDragOrder("'.$GLOBALS['var']['act'].'", "'.$cat.'", "", "'.$orderby.'", "'.$ordermode.'");';
    ?>
});
</script>
<?php echo module_open(); ?>
<tr class="nodrop">
    <?php if ($GLOBALS['per']['del']) echo '<td class="head center" width="1%"><input type="checkbox" class="checkAll" /></td>'; ?>
    <td class="head center" width="2%"><?php echo create_sort('id') ?>#</td>
    <td class="head" width="30%"><?php echo create_sort('name_vn') ?>Tiêu đề</td>
    <td class="head center hide640" width="5%">Hình ảnh</td>
    <td class="head center hide1024" width="5%"><?php echo create_sort('order_top') ?>Menu top</td>
    <td class="head center hide1024" width="5%"><?php echo create_sort('order_bottom') ?>Menu bottom</td>
    <td class="head center hide1024" width="5%"><?php echo create_sort('order_footer') ?>Menu footer</td>
    <td class="head center hide480" width="5%"><?php echo create_sort('sort_order') ?>Kích hoạt</td>
    <!-- <td class="head center hide480" width="5%"><?php echo create_sort('hot') ?>Hot</td> -->
    <td class="head center" width="1%">&nbsp;</td>
</tr>
<?php
if (count($articles) && is_array($articles))
{
    $i = 1;
    foreach ($articles as $data)
    {
?>
<tr class="highlight<?php echo ($data['isnew'] ? ' table-flag-red' : '') ?>" id="<?php echo $data['id'] ?>" name="<?php echo $data['name_vn'] ?>">
    <?php if ($GLOBALS['per']['del']) echo '<td class="fr center">'.sel_item($data['id']).'</td>'; ?>
    <td class="fr center"><?php echo stt($data['id'], $GLOBALS['var']['rowstart'] + $i++) ?></td>
    <td class="fr"><a href="<?php echo current_url().'/update/'.$data['id'].$uri_str ?>"><?php echo $data['name_vn'] ?></a></td>
    <td class="fr center hide640"><?php echo show_img(NEWS.'gallery/'.$data['img'], '', 'max-width:35px; max-height:35px;') ?></td>
    <td class="fr center hide1024"><?php echo change_status($data['id'], $data['menu_top'], 'menu_top', '', '', '', !$GLOBALS['per']['edit']) ?></td>
    <td class="fr center hide1024"><?php echo change_status($data['id'], $data['menu_bottom'], 'menu_bottom', '', '', '', !$GLOBALS['per']['edit']) ?></td>
    <td class="fr center hide1024"><?php echo change_status($data['id'], $data['menu_footer'], 'menu_footer', '', '', '', !$GLOBALS['per']['edit']) ?></td>
    <td class="fr center hide480"><?php echo change_status($data['id'], $data['active'], 'active', 'Kích hoạt', '', '', !$GLOBALS['per']['edit']) ?></td>
    <!-- <td class="fr center hide480"><?php echo change_status($data['id'], $data['hot'], 'hot', 'Hot', '', '', !$GLOBALS['per']['edit']) ?></td> --><!--kich hoat hot -->
    <td class="fr center" nowrap="nowrap">
        <?php if ($GLOBALS['per']['add']) echo '<a href="'.current_url().'/update'.($uri_str ? $uri_str.'&' : '?').'copyid='.$data['id'].'" title="Copy bài viết"><div class="icon glyphicons magic hide480"></div></a>'; ?>
        <?php if ($GLOBALS['per']['edit']) echo edit_alink('', current_url().'/update/'.$data['id'].$uri_str, 'hide480'); ?>
        <?php if ($GLOBALS['per']['del']) echo del_restore_link($data['id'], $data['deleted']); ?>
    </td>
</tr>
<?php
    }
}
else
{
    echo no_data_mes(10);
}
echo module_close();
?>